﻿#pragma once

#include <QObject>
#include <time.h>
#include "MarketDataBase.h"
#include "strategybase_global.h"
#include "UsrTradeInterface.h"
#include "MetricsDataGather.h"

class STRATEGYBASE_EXPORT StrategyBase : public QObject
{
	Q_OBJECT

public:
	StrategyBase(UsrTradeInterface *tradeHandler, QObject *parent);
	~StrategyBase();

	// 设置数据收集容器
	void SetStrategyDataGather(MetricsDataGather *dataGather) { m_dataGather = dataGather; }
	// 初始化
	virtual void Init(const std::string &pSymbol, time_t pToTime) = 0;
	// 行情，价格实时接收，K线频率会低，这个自己去本地获取,lastNewKTime大于0时表示刚才合成了1根K线
	virtual void OnMarketData(const std::string &pSymbol, time_t lastNewKTime, const MData::PriceItem &priceItem) = 0;
	// 清空初始化数据
	virtual void ClearInitData(const std::string &pSymbol) = 0;

protected:
	UsrTradeInterface *m_tradeHandler;
	MetricsDataGather *m_dataGather;
};
